﻿using System;
using System.Globalization;

namespace ProblemsSet
{
    public class Problem_36 : BaseProblem
    {
        public override object GetResult()
        {
            var res = 0;
            for (var i =0; i < 1000000; i++)
            {
                if (!MathLogic.IsPolindrom(i)) continue;
                var qq = Convert.ToString(i, 2);
                if (!MathLogic.IsPolindrom(qq)) continue;
                res += i;
            }
            return res;
        }

        public override string Problem
        {
            get
            {
                return @"The decimal number, 585 = 10010010012 (binary), is palindromic in both bases.

Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.

(Please note that the palindromic number, in either base, may not include leading zeros.)";
            }
        }

        public override bool IsSolved
        {
            get
            {
                return true;
            }
        }

        public override object Answer
        {
            get
            {
                return 872187;
            }
        }

    }
}
